<template>
  <div class="empty-container">
    <div class="empty-content">
      <el-icon class="empty-icon" :size="iconSize">
        <component :is="icon" />
      </el-icon>
      <div class="empty-text">{{ text }}</div>
      <div v-if="description" class="empty-description">{{ description }}</div>
      <div v-if="$slots.action" class="empty-action">
        <slot name="action" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Document, Box, Folder } from '@element-plus/icons-vue'

interface Props {
  text?: string
  description?: string
  icon?: any
  iconSize?: number
}

withDefaults(defineProps<Props>(), {
  text: '暂无数据',
  description: '',
  icon: Document,
  iconSize: 64
})
</script>

<style scoped>
.empty-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  padding: 40px 20px;
}

.empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 400px;
}

.empty-icon {
  color: var(--el-color-info-light-3);
  margin-bottom: 16px;
}

.empty-text {
  font-size: 16px;
  color: var(--el-text-color-regular);
  margin-bottom: 8px;
  font-weight: 500;
}

.empty-description {
  font-size: 14px;
  color: var(--el-text-color-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.empty-action {
  margin-top: 16px;
}
</style>